package com.idea.common.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author xumin
 * @since 2012-8-10
 * 
 */
public class SystemInfoUtils {

	private static String hostName;

	public static String getHostName() {
		if (StringUtils.isEmpty(hostName)) {
			InetAddress ia;
			try {
				ia = InetAddress.getLocalHost();
				hostName = ia.getHostName();
			} catch (UnknownHostException e) {
				e.printStackTrace();
				hostName = "NULL";
			}
		}
		return hostName;
	}

}
